package fr.umlv.m2.recipes.ideas.dao.interfaces;

import android.database.sqlite.SQLiteDatabase;

/**
 * Define a DAO which is a relation in the MPD
 * @author Christophe Chillan
 *
 * @param <T>
 */
public interface RecipesRelativeDAOInterface<T> {
	/**
	 * Call when the DAO is created
	 * @param db
	 */
	public void onCreate(SQLiteDatabase db);
	/**
	 * Use to insert a field in the database
	 * @param db
	 * @param bean
	 * @return long - the number of inserted lines 
	 */
	public long insert(SQLiteDatabase db, T bean);
	/**
	 * Call when the DAO is upgraded
	 * @param db
	 */
	public void onUpgrade(SQLiteDatabase db);
	/**
	 * Remove the relation from both of the ids in the relation 
	 * @param db
	 * @param firstId
	 * @param secondId
	 * @return integer - the number of lines deleted
	 */
	public int removeTheRelation(SQLiteDatabase db, int firstId,int secondId);

}
